home *** CD-ROM | disk | FTP | other *** search
/ Creative Computers / Creative Computers CD-ROM, Volume 1 (Legendary Design Technologies, Inc.)(1994).iso / shareware / fractals / apfelkiste / apfelkiste2.0 / source / apfelkiste2.0src.lzh / Misc.c < prev   
C/C++ Source or Header  |  1991-10-23  |  2KB  |  67 lines

  1. /************************************************************************/
  2. /* misc.c ---    Contains some intuition related functions that had to    */
  3. /*        be compiled separately due to faster debugging.        */
  4. /************************************************************************/
  5.  
  6. #include <exec/types.h>
  7. #include <exec/alerts.h>
  8. #include <intuition/intuitionbase.h>
  9. #include <intuition/intuition.h>
  10. #include <proto/intuition.h>
  11. #include <string.h>
  12.  
  13. extern struct IntuitionBase *IntuitionBase;
  14.  
  15. /* -------------------------------------------------------------------- */
  16. /* Make an Gadget "active", selected by window - ptr and Gadget ID.    */
  17. /* Used to make the cursor appear in the next String Gadget for        */
  18. /* convenience of the user.                        */
  19. /* -------------------------------------------------------------------- */
  20.  
  21. void __regargs Activate_Gadget(struct Window *w, USHORT ID)
  22. {
  23.     struct Gadget *g;
  24.  
  25.     g = w->FirstGadget;
  26.     while ( g && g->GadgetID != ID ) { g = g->NextGadget; }
  27.     if ( g ) { ActivateGadget(g, w, NULL); }
  28. }
  29.  
  30. /* -------------------------------------------------------------------- */
  31. /* Show a warning message by using a recoverable alert. Text is        */
  32. /* selected by an offset to message array below.            */
  33. /* -------------------------------------------------------------------- */
  34.  
  35. char *Apfel_Text[] = {
  36.     "   Everything OK\0",
  37.     "   Can't open intuition.library -- aborting\0",
  38.     "   Can't open graphics.library -- aborting\0",
  39.     "   Can't open iff.library V18.5+ -- aborting\0",
  40.     "   Can't open asl.library -- aborting\0",
  41.     "   Can't open color.library V1.0+ -- aborting\0",
  42.     "   No memory for filerequester -- aborting\0",
  43.     "   Can't open printer port -- aborting\0",
  44.     "   Can't open IORequest for printer -- aborting\0",
  45.     "   Can't open window -- trying to recover\0",
  46.     "   Can't open screen -- trying to recover\0",
  47.     "   Can't find configuration file --- using build in defaults\0",
  48.     "   IFF file not found -- Load aborted\0",
  49.     "   Not an IFF/ILBM file -- Load aborted\0",
  50.     "   Scrambled IFF file -- Load aborted\0",
  51.     "   Can't open gadtools.library -- aborting\0"
  52. };
  53.  
  54. void __regargs Apfel_Alert(long num)
  55. {
  56.     short x;
  57.  
  58.     x = IntuitionBase->ActiveScreen->Width;
  59.     if ( x > 740 ) x /= 2;
  60.     x = ( x - strlen(Apfel_Text[num]+3) * 8 ) / 2;
  61.     Apfel_Text[num][0] = x >> 8;
  62.     Apfel_Text[num][1] = x & 0xFF;
  63.     Apfel_Text[num][2] = 14;
  64.  
  65.     DisplayAlert(RECOVERY_ALERT, Apfel_Text[num], 23);
  66. }
  67.